package com.mzz.creational.singleton;

/**
 * 单例模式
 *
 * @author xushijian
 * @date 18/5/16
 */
public class SingletonSynchornizedMethod3_1 {

    private static SingletonSynchornizedMethod3_1 instance = null;

    private SingletonSynchornizedMethod3_1() {

    }

    private static synchronized void syncInit() {
        if (instance == null) {
            instance = new SingletonSynchornizedMethod3_1();
        }
    }


    public static SingletonSynchornizedMethod3_1 getInstance() {
        if (instance == null) {
            syncInit();
        }
        return instance;
    }


}
